$(function() {
	$('.banner').slide({
		titCell: '.hd ul',
		mainCell: '.bd ul',
		autoPage: true,
		autoPlay: true,
		effect: 'left',
		prevCell: ".banner_prev",
		nextCell: ".banner_next",
		trigger: "click",
		delayTime: 1000,
		interTime: 2500,
	});
	$('i.menu').on('click', function() {
		$(this).toggleClass('on');
		$('.drop>ul.bd').slideToggle();
	});
	$('.drop>ul>li.hd').on('click',function(){
		$(this).toggleClass('on');
		$(this).find('ul.bd').slideToggle();
	});
	

	$('.hslide').slide({
		vis: 'auto',
		trigger: "click",
		mainCell: ".hd ul",
		nextCell: ".jpro_next",
		prevCell: ".jpro_prev",
	});

	$('.bl').slide({
		effect: "left",
		trigger: "click",
		mainCell: '.bd ul',
		nextCell: ".jpro_next",
		prevCell: ".jpro_prev",
	});


	$('.yule').slide({
		mainCell: '.bd ul',
		autoPlay: true,
		effect: 'left',
		prevCell: ".yule_prev",
		nextCell: ".yule_next",
		trigger: "click",
		delayTime: 1000,
		interTime: 2500,
	});

	$('.ipro').slide({
		vis: '3',
		trigger: "click",
		mainCell: '.bd ul',
		effect: 'leftLoop',
		prevCell: ".ipro_prev",
		nextCell: ".ipro_next",
	});


	$("[data-fancybox]").fancybox({
		buttons: [
			"zoom",
			"download",
			"close"
		],
		animationEffect: "fade",
	});


	// 列表
	$(".select_box").on('click', function(e) {
		$(this).toggleClass('on').siblings().removeClass('on').find('.option').hide();
		e.stopPropagation();
		$(this).find(".option").slideToggle(200);
		$(this).parent().siblings().find(".option").hide();
	});


	/*赋值给文本框*/
	$(".option a").on('click', function() {
		var value = $(this).text();
		$(this).parent().siblings(".select_txt").text(value);
		$("#select_value").val(value)
	});
	//

	// 点击其它元素，取消当前状态
	$(document).on("click", function(e) {
		var target = $(e.target);
		//点击class为parentId之外的地方触发
		if (target.closest(".select_box").length == 0) {
			$(".select_box").removeClass('on');
		}

		if ($(".select_box").is(":visible") && target.attr("class") != "option" && !target.parent(".option").length)
			$('.option').hide();
	});

});
